// run: $exec < input
#include <iostream>

int const maxn = 2000;
int h[maxn];
int n;

int main()
{
	std::ios::sync_with_stdio(false);
	while (std::cin >> n) {
		for (int i = 1; i <= n; i++)
			std::cin >> h[i];
		int ans = 0;
		for (int i = 1; i <= n; i++) {
			int tot = 1;
			for (int j = i - 1; j > 0; j--)
				if (h[j] >= h[i]) tot++;
				else break;
			for (int j = i + 1; j <= n; j++)
				if (h[j] >= h[i]) tot++;
				else break;
			if (h[i] * tot > ans)
				ans = h[i] * tot;
		}
		std::cout << ans << "\n";
	}
}

